package com.xiaochen.baidu.service.filter;

import com.xiaochen.baidu.common.design.link.ILogicHandler;
import com.xiaochen.baidu.common.design.strategy.StrategyHandler;
import com.xiaochen.baidu.model.entity.RuleCommandEntity;
import com.xiaochen.baidu.service.factory.DefaultRuleFilterFactory;
import com.xiaochen.baidu.service.node.LoginNode;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * @author xc
 * @date 2025/10/11/22:37
 * @desc
 */
@Service
public class LoginFilter implements ILogicHandler<RuleCommandEntity, DefaultRuleFilterFactory.RuleDynamicContext, StrategyHandler> {
    @Resource
    private LoginNode loginNode;


    @Override
    public StrategyHandler handle(RuleCommandEntity requestParameter, DefaultRuleFilterFactory.RuleDynamicContext ruleDynamicContext) throws Exception {
        return null == requestParameter.getKdownSession() ? loginNode : next(requestParameter, ruleDynamicContext);
    }
}
